function selectAll(num){//work
    //alert("sss "+num);
    var checked = document.getElementById("selectAll").checked;
    //alert('ddd '+checked);
    for(var i=0;i<num;i++){
        if(checked){
            document.getElementById("row"+i).checked="checked";
        }else{
            document.getElementById("row"+i).checked="";
        }
    }
} 
function unSelectAll(num){//work
    document.getElementById("selectAll").checked="";
    //alert(num);
    for(var i=0;i<num;i++){
        document.getElementById("row"+i).checked="";
   		
    }
}
function goDelete(url,id,msg){//work
    var ans = confirm(msg);
    if(ans){
        document.getElementById(id).href = url;
    }
}
function goDeleteSelect(url,count,msg){//work
    var idList = "";
    var k = 0;
	
    for(var i=0;i<count;i++){
        var row = document.getElementById("row"+i)
        if(row.checked){
            if(k!=0) idList += ","+row.value;
            else idList += row.value;
            k++;
        }
    }
    if(k > 0){
        var ans = confirm(msg);
        if(ans){
            document.getElementById("deleteIdList").value=idList;
            //alert("DD "+document.getElementById("deleteIdList").value);
            if(checkBrowser() == "Microsoft Internet Explorer"){
                //alert("IE");
                url = url+"?deleteIdList="+idList;
                document.getElementById("Ddeleteselect").href = url;
            }else{
                //alert("FF");
                document.forms[0].action = url;
                document.forms[0].method = "post";	//use post will keep string to longer than get
                document.forms[0].submit();
            }
        }//ans
    }
}  

////////////////////////////
function addModule(){
    showDiv('addModule');
    document.forms[0].name.value = '';
    document.forms[0].detail.value = '';
    document.forms[0].link.value = '';
    document.forms[0].enable[0].selected = "selected";
    document.getElementById("mode").value = "0";
}
function editModule(id,name,detail,link,enable){//work
    showDiv('addModule');
    document.forms[0].name.value = name;
    document.forms[0].detail.value = detail;
    document.forms[0].link.value = link;
	
    if(enable=="y"){
        document.forms[0].enable[0].selected = "selected";
    }else{
        document.forms[0].enable[1].selected = "selected";
    }
    document.getElementById("mode").value = "1";
    document.getElementById("eid").value = id;
}
////////////////////////////
function addSystems(){
    showDiv('addSystems');
    document.forms[0].name.value = '';
    document.forms[0].detail.value = '';
    document.forms[0].enable[0].selected = "selected";
    document.getElementById("mode").value = "0";
}
function editSystems(id,name,detail,enable){//work
    showDiv('addSystems');
    document.forms[0].name.value = name;
    document.forms[0].detail.value = detail;
	
    if(enable=="y"){
        document.forms[0].enable[0].selected = "selected";
    }else{
        document.forms[0].enable[1].selected = "selected";
    }
    document.getElementById("mode").value = "1";
    document.getElementById("eid").value = id;
}
////////////////////////////
function addRole(){
    showDiv('addRole');
    document.forms[0].name.value = '';
    document.forms[0].detail.value = '';
    document.forms[0].enable[0].selected = "selected";
    document.getElementById("mode").value = "0";
}
function editRole(id,name,detail,enable){//work
    showDiv('addRole');
    document.forms[0].name.value = name;
    document.forms[0].detail.value = detail;
	
    if(enable=="y"){
        document.forms[0].enable[0].selected = "selected";
    }else{
        document.forms[0].enable[1].selected = "selected";
    }
    document.getElementById("mode").value = "1";
    document.getElementById("eid").value = id;
}
////////////////////////////
function addProvider(){
    showDiv('addProvider');
    document.forms[0].name.value = '';
    document.forms[0].detail.value = '';
    document.getElementById("mode").value = "0";
}
function editProvider(id,name,detail){//work
    showDiv('addProvider');
    document.forms[0].name.value = name;
    document.forms[0].detail.value = detail;

    document.getElementById("mode").value = "1";
    document.getElementById("eid").value = id;
}
////////////////////////////
function addOperation(){
    showDiv('addOperation');
    document.forms[0].name.value = '';
    document.forms[0].detail.value = '';
    document.getElementById("mode").value = "0";
}
function editOperation(id,name,detail){//work
    showDiv('addOperation');
    document.forms[0].name.value = name;
    document.forms[0].detail.value = detail;

    document.getElementById("mode").value = "1";
    document.getElementById("eid").value = id;
}
////////////////////////////
function addTransform(){
    showDiv('addTransfrom');
    document.forms[0].name.value = '';
    document.forms[0].xml_path.value = '';
    document.forms[0].xsl_path.value = '';
    document.getElementById("mode").value = "0";
}
function editTransform(id,name,xml,xsl){//work
    showDiv('addTransfrom');
    document.forms[0].name.value = name;
    document.forms[0].xml_path.value = xml;
    document.forms[0].xsl_path.value = xsl;
	
    document.getElementById("mode").value = "1";
    document.getElementById("eid").value = id;
}

